var vue = new Vue({
    el: "#app",
    data: {
        city: "",
        weatherList: []
    },
    methods: {
        searchWeather: function () {
            console.log('天气查询');
            console.log(this.city);

            /**
             * 注意: 需要保存this
             * @type {methods}
             */
            var temp = this;
            // 调用接口
            // http://wthrcdn.etouch.cn/weather_mini?city
            axios.get('http://wthrcdn.etouch.cn/weather_mini?city=' + this.city)
                .then(function (response) {
                    // console.log(response);
                    // console.log(response.data.data.forecast);

                    temp.weatherList = response.data.data.forecast;
                })
                .catch(function (err) {
                    console.log(err)
                })
        },
        changeCity: function (city) {
            this.city = city;
            console.log(city);
            this.searchWeather();
        }
    }
});